<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/common_header.jsp" %>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>


<!-- jQuery와 Postcodify를 로딩한다 -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//cdn.poesis.kr/post/search.min.js"></script>
<link href="//cdn.poesis.kr/post/search.css" rel="stylesheet" media="all" />
<link href="http://postcodify.poesis.kr/assets/libs/normalize-1.1.3.css" rel="stylesheet" media="all" />
<link href="http://postcodify.poesis.kr/assets/postcodify.css?v=2.3.0-2" rel="stylesheet" media="all" />
<link href="http://postcodify.poesis.kr/assets/links/popup.css?v=2.3.0-2" rel="stylesheet" media="all" />
<link href="http://postcodify.poesis.kr/assets/links/search.css?v=2.3.0-2" rel="stylesheet" media="all" />
<!-- 위에서 생성한 <div>에 검색 기능을 표시하고, 결과를 입력할 <input>들과 연동한다 -->
<script language="javascript">

// 검색 버튼 클릭
function funChoice() {
	
	var postcode = $("#postcode").val();
	var jibun_address = $("#jibun_address").val();
	var jibun_details = $("#details").val();
	
	if($("#postcode").val() == ""){
		alert("주소를 입력 해주세요");
		return;
	}
	
	if($("#details").val() == ""){
		alert("상세 주소를 입력 해주세요");
		$("#details").focus();
		return;
	}
	
	$(opener.document).find("#postcode").val(postcode);
	$(opener.document).find("#jibun_address").val(jibun_address);
	$(opener.document).find("#jibun_details").val(jibun_details);
    window.close();
}


</script>


<body>
<div class="con_area" style="width: 800px">
<br><br>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
    <tr>
        <td align="left"><h2 class="tit">우편번호 검색</h2></td>
    </tr>
    <tr>
        <td align="left"><h2 class="tit"><font color="orange">※ 정확한 도로명과 건물번호 또는 동·리와 번지로 검색해 주시기 바랍니다.</font></h2></td>
    </tr>    
    
</table>			
			
			
<!-- 검색 기능을 표시할 <div>를 생성한다 -->
<div id="postcodify"></div>

<!-- 주소와 우편번호를 입력할 <input>들을 생성하고 적당한 name과 id를 부여한다 -->
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01">
            <tr>
                <td class="data_01" style='width:100px; text-align:left;'>&nbsp;우편번호</td>
                <td class="data_02">
                    <input type="text" id="postcode" name="postcode" value="" size="20" disabled/>
                </td>
            </tr>
            <tr>
                <td class="data_01" style='width:100px; text-align:left;'>&nbsp;도로명주소</td>
                <td class="data_02">
                    <input type="text" id="address" name="address" value="" size="60" disabled/>
                </td>
            </tr>
			<tr>
                <td class="data_01" style='width:100px; text-align:left;'>&nbsp;지번주소</td>
                <td class="data_02">
                    <input type="text" id=jibun_address name="jibun_address" value="" size="60" disabled/>
                </td>
            </tr>     
			<tr>
                <td class="data_01" style='width:100px; text-align:left;'>&nbsp;상세주소</td>
                <td class="data_02">
                    <input type="text" id="details" name="details" value="" size="60"/>
                </td>
            </tr>                                   
        </table>
        <br>
			<p align="center">
	 				<input type='button' class='button_63_01' value='선택' onclick='funChoice();'>
        	</p>
        	<br>
</div>

</body>

<script>
    $(function() { $("#postcodify").postcodify({
        insertPostcode6 : "#postcode6",
        insertPostcode6 : "#postcode",
        insertAddress : "#address",
        insertDetails : "#details",
        insertJibeonAddress : "#jibun_address",
        insertExtraInfo : "#extra_info"
    }); });
</script>
		